package com.daycomtech.jgooglechart.charts;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;

import com.daycomtech.jgooglechart.JGChartConstants;
import com.daycomtech.jgooglechart.util.JGChartMakerStringUtil;

public class JGPieChart extends JGChart
{
	static public final String PieChart2D = JGChartConstants.PieChart2D;
	static public final String PieChart3D = JGChartConstants.PieChart3D;

	public JGPieChart (int width, int height)
	{
		super(width, height);
		super.setType(PieChart2D);
	}

	public JGPieChart (int width, int height, String type)
	{
		super(width, height);
		super.setType(type);
	}

	public JGPieChart (int height, String type)
	{
		super(height);
		super.setType(type);
	}

	@Override
	public String getUrlString() throws UnsupportedEncodingException
	{
		String urlString="";

		ArrayList<String> urlStringParts = new ArrayList<String>();

		String chartSizeS = JGChartMakerStringUtil.getChartSize(super.getWidth(), super.getHeight());
		urlStringParts.add(chartSizeS);

		String chartDataS = JGChartMakerStringUtil.getChartData(super.getData());
		urlStringParts.add(chartDataS);

		String chartTypeS = JGChartMakerStringUtil.getChartType(super.getType());
		urlStringParts.add(chartTypeS);

		String chartLabelsS = JGChartMakerStringUtil.getChartLabels(super.getLabels());
		urlStringParts.add(chartLabelsS);

		String chartColorsS = JGChartMakerStringUtil.getChartColors(super.getColors());
		urlStringParts.add(chartColorsS);

		urlString = JGChartMakerStringUtil.getUrlString(urlStringParts);


		return urlString;
	}
}
